<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>location对象</title>
</head>
<body>
    <script>
        // console.log(location);
        console.table(location)
        let search = location.search
        if(search){
            //?a=11&b=22
            console.log(search);
            //['a=11','b=22']
            let arr1 = search.replace("?","").split('&')
            console.log(arr1);
            //[['a','11'],['b','22']]
            let arr2 = arr1.map(r=>r.split('='))
            console.log(arr2);
            let obj = {}
            arr2.forEach(r=>{
                obj[r[0]] = r[1]
            })
            console.log(obj);
            console.log(obj.c);
        }
    </script>
</body>
</html>